<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: Sifteo::MotionMedian Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>Sifteo</b></li><li class="navelem"><a class="el" href="class_sifteo_1_1_motion_median.html">MotionMedian</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_sifteo_1_1_motion_median-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Sifteo::MotionMedian Class Reference<div class="ingroups"><a class="el" href="group__motion.html">Motion</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Calculate median, minimum, and maximum statistics from a <a class="el" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer</a>.  
 <a href="class_sifteo_1_1_motion_median.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="motion_8h_source.html">sifteo/motion.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a640326844dac4892ce7e4fca59a16476"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#a640326844dac4892ce7e4fca59a16476">calculate</a> (_SYSMotionBuffer *mbuf, unsigned duration)</td></tr>
<tr class="memdesc:a640326844dac4892ce7e4fca59a16476"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the component-wise median of recent motion data.  <a href="#a640326844dac4892ce7e4fca59a16476">More...</a><br/></td></tr>
<tr class="separator:a640326844dac4892ce7e4fca59a16476"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeed3435a8cfe983475e5108073d2f1e8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeed3435a8cfe983475e5108073d2f1e8"></a>
<a class="el" href="group__math.html#gaec7afb90b5c1db8751abaf5f0406f6b7">Byte3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#aeed3435a8cfe983475e5108073d2f1e8">maximum</a> () const </td></tr>
<tr class="memdesc:aeed3435a8cfe983475e5108073d2f1e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the maximum values for each axis, as a vector. <br/></td></tr>
<tr class="separator:aeed3435a8cfe983475e5108073d2f1e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3ea8f8cef6a95dbefedae89de20dd4b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad3ea8f8cef6a95dbefedae89de20dd4b"></a>
<a class="el" href="group__math.html#gaec7afb90b5c1db8751abaf5f0406f6b7">Byte3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#ad3ea8f8cef6a95dbefedae89de20dd4b">median</a> () const </td></tr>
<tr class="memdesc:ad3ea8f8cef6a95dbefedae89de20dd4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the median itself, as a vector. <br/></td></tr>
<tr class="separator:ad3ea8f8cef6a95dbefedae89de20dd4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7e3a6787c29077057cc9a69988fcb33c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7e3a6787c29077057cc9a69988fcb33c"></a>
<a class="el" href="group__math.html#gaec7afb90b5c1db8751abaf5f0406f6b7">Byte3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#a7e3a6787c29077057cc9a69988fcb33c">minimum</a> () const </td></tr>
<tr class="memdesc:a7e3a6787c29077057cc9a69988fcb33c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the minimum values for each axis, as a vector. <br/></td></tr>
<tr class="separator:a7e3a6787c29077057cc9a69988fcb33c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acdb84a9e5df6db28508ee99d4bd2b9b8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acdb84a9e5df6db28508ee99d4bd2b9b8"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#acdb84a9e5df6db28508ee99d4bd2b9b8">MotionMedian</a> ()</td></tr>
<tr class="memdesc:acdb84a9e5df6db28508ee99d4bd2b9b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct an uninitialized <a class="el" href="class_sifteo_1_1_motion_median.html" title="Calculate median, minimum, and maximum statistics from a MotionBuffer.">MotionMedian</a>. <br/></td></tr>
<tr class="separator:acdb84a9e5df6db28508ee99d4bd2b9b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26f7653215a65546bf50d185a4899939"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26f7653215a65546bf50d185a4899939"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#a26f7653215a65546bf50d185a4899939">MotionMedian</a> (_SYSMotionBuffer *mbuf, unsigned duration)</td></tr>
<tr class="memdesc:a26f7653215a65546bf50d185a4899939"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a <a class="el" href="class_sifteo_1_1_motion_median.html" title="Calculate median, minimum, and maximum statistics from a MotionBuffer.">MotionMedian</a> with data calculated from the supplied <a class="el" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer</a>. <br/></td></tr>
<tr class="separator:a26f7653215a65546bf50d185a4899939"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af63de7f4088908f8683b4263ef749a6d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af63de7f4088908f8683b4263ef749a6d"></a>
<a class="el" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e">Int3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sifteo_1_1_motion_median.html#af63de7f4088908f8683b4263ef749a6d">range</a> () const </td></tr>
<tr class="memdesc:af63de7f4088908f8683b4263ef749a6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the difference between maximum and minimum, as a vector. <br/></td></tr>
<tr class="separator:af63de7f4088908f8683b4263ef749a6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Calculate median, minimum, and maximum statistics from a <a class="el" href="struct_sifteo_1_1_motion_buffer.html" title="A memory buffer which holds captured motion data.">MotionBuffer</a>. </p>
<p>This structure contains the results of a median calculation, including the median vector itself as well as min/max stats that we get "for free" as a result of the median calculation. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a640326844dac4892ce7e4fca59a16476"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void Sifteo::MotionMedian::calculate </td>
          <td>(</td>
          <td class="paramtype">_SYSMotionBuffer *&#160;</td>
          <td class="paramname"><em>mbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned&#160;</td>
          <td class="paramname"><em>duration</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Calculate the component-wise median of recent motion data. </p>
<p>The duration is specified in units as defined by TICK_NS, TICK_US, and TICK_HZ. The median accelerometer sample over this duration is calculated and returned. Medians are calculated independently for each of the three channels. No scaling is applied.</p>
<p>The result is written to the supplied <a class="el" href="class_sifteo_1_1_motion_median.html" title="Calculate median, minimum, and maximum statistics from a MotionBuffer.">MotionMedian</a> buffer. This includes the median itself, as well as the maximum and minimum values, which we get 'for free' as a result of the median calculation.</p>
<p>Unlike the moving-average filter that can be built with integrate(), this algorithm provides a way of filtering data which is very good at eliminating brief spikes but preserving hard edges. The 'duration' parameter will set the latency at which we detect these edges. Spikes up to half this duration can be completely eliminated from the output, unlike in a typical low-pass filter where such spikes just end up 'smeared' into your data. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="motion_8h_source.html">motion.h</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
